const botUserAgentPatterns = [
  /adsbot-google/i,
  /ahrefsbot/i,
  /apis-google/i,
  /applebot/i,
  /duplexweb-google/i,
  /baiduspider/i,
  /feedfetcher-google/i,
  /bingbot/i,
  /google favicon/i,
  /bingpreview/i,
  /google web preview/i,
  /bot\.htm/i,
  /google-read-aloud/i,
  /bot\.php/i,
  /googlebot/i,
  /crawler/i,
  /googleweblight/i,
  /duckduckbot/i,
  /mediapartners-google/i,
  /facebookexternal/i,
  /storebot-google/i,
  /facebookcatalog/i,
  /Google-HotelAdsVerifier/i,
  /gptbot/i,
  /hubspot/i,
  /linkedinbot/i,
  /mj12bot/i,
  /petalbot/i,
  /pinterest/i,
  /prerender/i,
  /rogerbot/i,
  /screaming frog/i,
  /semrushbot/i,
  /sitebulb/i,
  /twitterbot/i,
  /yahoo! slurp/i,
  /yandexbot/i,
];

export const isBot = (userAgent: string | undefined | null): boolean => {
  if (!userAgent) return false;
  return botUserAgentPatterns.some((pattern) => pattern.test(userAgent));
};
